<?php 
    $tems = new XTemplate('sites/tpml/qlhs/listall.html');
    $idnam = $_GET['idnam'];
    $idkhoi = $_GET['idkhoi'];
    $idlop = $_GET['idlop'];
    $sql = "SELECT hocsinh.*,lop.ten AS tenlop,khoi.ten AS khoi FROM hocsinh
            LEFT JOIN lop ON hocsinh.lop = lop.id 
            LEFT JOIN khoi ON lop.id_khoi = khoi.id 
            LEFT JOIN namhoc ON khoi.id_namhoc = namhoc.id
            WHERE lop.id=$idlop AND khoi.id=$idkhoi AND namhoc.id=$idnam
            ";
    $data = $db->GetArray($sql);
   // print_r($data);
    foreach($data as $value){
        $tems->insert_loop('HSLISTALL.LOOP',array('LOOP'=>$value));
    }
    $tems->assign('tit', 'Danh sách học sinh');
    $tems->parse('HSLISTALL');
    $maincontent = $tems->text('HSLISTALL');
?>